﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MyDMS.BusinessLayer;

public partial class JobDescriptions : PageBaseClass
{
    JobDescriptionFactory jdFactory;
    protected void Page_Load(object sender, EventArgs e)
    {
        jdFactory = new JobDescriptionFactory();
        List<JobDescription> jds = jdFactory.GetAllBy(JobDescription.JobDescriptionFields.Office_Code, _author.office_Code);
        this.gvJDs.DataSource = jds;
        this.gvJDs.DataBind();
    }

    protected void btnSave_Click(object sender, EventArgs e)
    {
        JobDescription JD = new JobDescription();
        JD.JD_Name = txtJobName.Text;
        JD.Job_Description = txtDescription.Text;
        JD.Office_Code = _author.office_Code;

        jdFactory = new JobDescriptionFactory();
        if (jdFactory.Insert(JD))
        {
            lblMessage.Text = "Saved Successfully";
        }
        else
        {
            lblMessage.Text = "Error!";
        }
        lblMessage.Visible = true;
    }
}
